Attribute VB_Name = "Module_LocGrp"
Function LocGrpInsertMaster(v As VisM, ByVal Code As String, ByVal Desc As String) As Boolean
    v.P1 = Code
    v.P2 = Desc
    v.Execute "$$InsertMast^DHCSTCTLOCGROUP(P1,P2)"
    If v.Error <> 0 Then
        LocGrpInsertMaster = False
        Exit Function
    End If
    LocGrpInsertMaster = True
End Function
Function LocGrpUpdateMaster(v As VisM, ByVal id As String, ByVal Code As String, ByVal Desc As String) As Boolean
    v.P1 = id
    v.P2 = Code
    v.P3 = Desc
    v.Execute "$$UpdateMast^DHCSTCTLOCGROUP(P1,P2,P3)"
    If v.Error <> 0 Then
        LocGrpUpdateMaster = False
        Exit Function
    End If
    If v.Value = 1 Then
        LocGrpUpdateMaster = True
    Else
        LocGrpUpdateMaster = False
    End If
End Function
Function LocGrpDelMaster(v As VisM, ByVal rid As String) As Boolean
    v.P1 = rid
    v.Execute "$$DeleteMast^DHCSTCTLOCGROUP(P1)"
    If v.Error <> 0 Then
        LocGrpDelMaster = False
        Exit Function
    End If
    
    LocGrpDelMaster = True

End Function

Function LocGrpGetRela(v As VisM, mrowid, locdr) As Boolean
    v.P1 = mrowid
    v.P2 = locdr
    Call Restore_Connect(v)
    v.Execute "$$GetRel^DHCSTCTLOCGROUP(P1,P2)"
    If v.Error <> 0 Then
        MsgBox "error"
        LocGrpGetRela = False
        Exit Function
    End If
    If v.Value = "1" Then
        LocGrpGetRela = True
    Else
        LocGrpGetRela = False
    End If
    
End Function
Function Get_LocCatGrpRel(v As VisM, ByVal mrowid, ByVal locrowid As String) As String
    v.P1 = mrowid
    v.P2 = locrowid
    Call Restore_Connect(v)
    v.Execute "$$GetRel^DHCSTCTLOCGROUP(P1,P2)"
    If v.Error <> 0 Then
        MsgBox "error"
        Exit Function
    End If
    Get_LocCatGrpRel = v.Value
End Function
